#include "tileViewbox.h"
#include <SFML/Graphics.hpp>

tileViewbox::tileViewbox()
{
}

void tileViewbox::setTileSheet(sf::Texture* p_tilesheet)
{
	m_subTile.setTexture(*p_tilesheet);
}

void tileViewbox::setBorderSheet(sf::Texture* p_tilesheet)
{
	m_borderBox.setTexture(p_tilesheet);
}

void tileViewbox::setTile(int p_tileX, int p_tileY)
{
	m_subTile.setTextureRect(sf::IntRect(p_tileX*m_tile_size, p_tileY*m_tile_size, m_tile_size, m_tile_size));
}

void tileViewbox::draw(sf::RenderWindow* App)
{
	m_borderBox.draw(App);
	App->draw(m_subTile);
}

void tileViewbox::setPosition(int p_x, int p_y)
{
	m_borderBox.setPosition(p_x, p_y);
	m_subTile.setPosition(p_x + m_tile_size, p_y + m_tile_size);
}

void tileViewbox::setScale(int p_scale)
{
	m_subTile.setScale(p_scale, p_scale);
	m_borderBox.setSize(p_scale+2, p_scale+2);
}
